package com.youlu.campus.entity.commission.dto;

import lombok.Getter;
import lombok.Setter;

import java.math.BigDecimal;

@Getter
@Setter
public class CalCommissionDTO {
    /**
     * 基础佣金比例
     */
    private Double baseCommissionRatio;

    /**
     * 增长佣金比例
     */
    private Integer incCommissionRatio;

    /**
     *当前新佣金比例
     */
    private BigDecimal currentCommissionRatio;

    /**
     * 分拥金额(单位：分)
     */
    private Integer sharingCommissionAmount;

    public void calSharingCommissionAmount(BigDecimal amount){
        BigDecimal sharingProfitRatioNew = BigDecimal.valueOf(this.baseCommissionRatio).multiply(BigDecimal.valueOf(100)).add(BigDecimal.valueOf(this.incCommissionRatio).multiply(BigDecimal.valueOf(this.baseCommissionRatio)));
        this.currentCommissionRatio = sharingProfitRatioNew.divide(new BigDecimal(10000), 4, BigDecimal.ROUND_HALF_UP);
        this.sharingCommissionAmount = amount.multiply(currentCommissionRatio).intValue();
    }


}
